﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BoAddonBiz_FreightForwarder.Custom.Models
{
    internal class CustomsLine
    {
        public string RowId { get; set; }
        public string ItemCode { get; set; }
        public string Description { get; set; }
        public string Standard { get; set; }
        //public string Quantity { get; set; }
        //public string Unit { get; set; }
        public string Country { get; set; }
        private string _Amount;
        public string Amount
        {
            get
            {
                if (string.IsNullOrEmpty(_Amount))
                    _Amount = "0";
                return _Amount;
            }
            set { _Amount = value; }
        }
        public string Currency { get; set; }
        public string Nature { get; set; }

        private string _FirstQuantity;
        public string FirstQuantity
        {
            get
            {
                if (string.IsNullOrEmpty(_FirstQuantity))
                    _FirstQuantity = "0";
                return _FirstQuantity;
            }
            set { _FirstQuantity = value; }
        }
        public string FirstUnit { get; set; }

        private string _SecondQuantity;
        public string SecondQuantity
        {
            get
            {
                if (string.IsNullOrEmpty(_SecondQuantity))
                    _SecondQuantity = "0";
                return _SecondQuantity;
            }
            set { _SecondQuantity = value; }
        }

        public string SecondUnit { get; set; }

        private string _ThirdQuantity;
        public string ThirdQuantity
        {
            get
            {
                if (string.IsNullOrEmpty(_ThirdQuantity))
                    _ThirdQuantity = "0";
                return _ThirdQuantity;
            }
            set { _ThirdQuantity = value; }
        }

        public string ThirdUnit { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public string Price
        {
            get
            {
                decimal Total = string.IsNullOrEmpty(Amount) ? 0 : Convert.ToDecimal(Amount);
                decimal Quantity = string.IsNullOrEmpty(ThirdQuantity) ? 1 : Convert.ToDecimal(ThirdQuantity);
                return (Math.Round(Total / Quantity, 2)).ToString();
            }
        }
    }
}
